{php}
$this->assign('errors', array_filter((array)@$this->_tpl_vars['form']['errors']));
{/php}


<span id="message-container">
    {if is_array($message)}
    <div class="message {if $message.status}info{else}error{/if}">
        {$message.contents}
        {if $errors}
        <ul>
            {foreach from=$errors key=name item=error}
            {if isset($form.elements.$name)}
            <li>{$form.elements.$name.caption|translate}: {$error}.</li>
            {/if}
            {/foreach}
        </ul>
        {/if}
    </div>
    {/if}
</span>
